package com.责任链模式;

/**
 * 组长
 * @author Fang Ruichuan
 * @date 2022-09-03 12:57
 */
public class GroupLeader implements Ratify{
    @Override
    public Result deal(Chain chain) {
        Request request = chain.request();
        System.out.println("GroupLeader=====>request: " + request.toString());
        if (request.getDays() > 2) {
            // 包装新的Request对象
            Request newRequest = new Request.Builder().newRequest(request)
                    .managerInfo(request.getName() + "平时表现不错，而且现在项目也不忙")
                    .build();
            return chain.proceed(newRequest);
        }
        return new Result(true, "GroupLeader: 早去早回");
    }
}
